<template>
  <div class="app-container">
    <div class="custom_card_0" v-show="showSearch">
      <!-- 筛选form-->
      <el-form
        :model="queryParams"
        ref="queryForm"
        :inline="true"
        label-width="68px"
      >
        <el-form-item label="门店名称" prop="storeName">
          <el-input
            v-model="queryParams.storeName"
            placeholder="请输入门店名称"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="所在省" prop="provinceName">
          <el-input
            v-model="queryParams.provinceName"
            placeholder="请输入所在省"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="所在市" prop="cityName">
          <el-input
            v-model="queryParams.cityName"
            placeholder="请输入所在市"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="所在区" prop="areaName">
          <el-input
            v-model="queryParams.areaName"
            placeholder="请输入所在区"
            clearable
            size="small"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="是否启用" prop="isAvailable">
          <el-select
            v-model="queryParams.isAvailable"
            placeholder="请选择是否启用"
            clearable
            size="small"
          >
            <el-option
              v-for="dict in dict.type.sys_available"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuery"
            >搜索</el-button
          >
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="custom_card">
      <!-- 工具条-->
      <el-row :gutter="10" class="mb10">
        <el-col :span="1.5">
          <el-button
            class="first-plain-btn"
            size="medium"
            icon="el-icon-plus"
            @click="handleAdd"
            v-hasPermi="['store:store:add']"
            >新增
          </el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            class="sec-plain-btn"
            size="medium"
            icon="el-icon-download"
            :loading="exportLoading"
            @click="handleExport"
            v-hasPermi="['store:store:export']"
            >导出
          </el-button>
        </el-col>
        <right-toolbar
          :showSearch.sync="showSearch"
          @queryTable="getList"
        ></right-toolbar>
      </el-row>

      <!-- 表格-->
      <el-table
        v-loading="loading"
        :data="storeList"
        @selection-change="handleSelectionChange"
        border
      >
        <el-table-column
          label="门店名称"
          align="center"
          v-if="columns[0].visible"
          show-overflow-tooltip
          min-width="160"
        >
          <template slot-scope="{ row }">
            <div style="width: 100%; text-align: center">
              <el-button
                type="text"
                style="font-size: 14px"
                size="small"
                @click="handleDetail(row)"
                >{{ row.storeName }}</el-button
              >
            </div>
          </template>
        </el-table-column>
        <el-table-column
          label="联系人"
          align="center"
          prop="contactName"
          v-if="columns[2].visible"
          show-overflow-tooltip
          min-width="120"
        />
        <el-table-column
          label="联系电话"
          align="center"
          prop="contactPhone"
          v-if="columns[3].visible"
          show-overflow-tooltip
          min-width="160"
        />
        <el-table-column
          label="归属部门"
          align="center"
          prop="companyName"
          v-if="columns[4].visible"
          show-overflow-tooltip
          min-width="160"
        />
        <el-table-column
          label="所在省/市/区"
          align="center"
          v-if="columns[5].visible"
          show-overflow-tooltip
          min-width="160"
        >
          <template slot-scope="scope">
            {{ scope.row.provinceName }}{{ scope.row.cityName
            }}{{ scope.row.areaName }}
          </template>
        </el-table-column>
        <el-table-column
          label="详细地址"
          align="center"
          prop="addrDetail"
          v-if="columns[6].visible"
          show-overflow-tooltip
          min-width="260"
        />
        <el-table-column
          label="营业时间"
          align="center"
          show-overflow-tooltip
          min-width="160"
          v-if="columns[6].visible"
        >
          <template slot-scope="scope">
            {{ scope.row.businessStartTime }}--{{ scope.row.businessEndTime }}
          </template>
        </el-table-column>
        <el-table-column
          label="是否启用"
          align="center"
          prop="isAvailable"
          v-if="columns[7].visible"
          show-overflow-tooltip
          min-width="100"
        >
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_available"
              :value="scope.row.isAvailable"
            />
          </template>
        </el-table-column>
        <el-table-column
          label="操作"
          align="center"
          class-name="small-padding fixed-width"
          width="240"
          fixed="left"
        >
          <template slot-scope="scope">
            <el-button size="mini" type="text" @click="handleDetail(scope.row)"
              >查看
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleUpdate(scope.row)"
              v-if="scope.row.isAvailable == 0"
              v-hasPermi="['store:store:edit']"
              >修改
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleDelete(scope.row)"
              v-if="scope.row.isAvailable == 0"
              v-hasPermi="['store:store:remove']"
              >删除
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleAvailable(scope.row.storeId, 1)"
              v-if="scope.row.isAvailable == 0"
              v-hasPermi="['store:store:edit']"
              >启用
            </el-button>
            <el-button
              size="mini"
              type="text"
              @click="handleAvailable(scope.row.storeId, 0)"
              v-if="scope.row.isAvailable == 1"
              v-hasPermi="['store:store:edit']"
              >停用
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页组件-->
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
    <!-- 添加或修改门店基本信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="60vw" append-to-body>
      <el-row :gutter="15">
        <el-form
          ref="elForm"
          :model="form"
          :rules="rules"
          size="medium"
          label-width="100px"
        >
          <MmvTitle title="基本信息"></MmvTitle>
          <el-col :span="12">
            <el-form-item label="门店名称" prop="storeName">
              <el-input
                v-model="form.storeName"
                placeholder="请输入门店名称"
                clearable
                :style="{ width: '100%' }"
                :disabled="!edit"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="门店联系人" prop="contactName">
              <el-input
                v-model="form.contactName"
                placeholder="请输入门店联系人"
                clearable
                :style="{ width: '100%' }"
                :disabled="!edit"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系电话" prop="contactPhone">
              <el-input
                v-model="form.contactPhone"
                placeholder="请输入联系电话"
                clearable
                :style="{ width: '100%' }"
                maxlength="11"
                :disabled="!edit"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="门店地址" prop="areaName">
              <el-cascader
                clearable
                size="large"
                ref="myCascader"
                style="width: 50%"
                :options="options"
                :disabled="!edit"
                v-model="selectedOptions"
                placeholder="请选择省/市/区"
                @change="handleChange"
              ></el-cascader>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="经纬度" prop="storeLon">
              <el-input
                v-model="form.storeLon"
                placeholder="经度"
                clearable
                :style="{ width: '25%' }"
                readonly="readonly"
              >
                <template slot="prepend">经度</template>
              </el-input>
              --
              <el-input
                v-model="form.storeLat"
                placeholder="纬度"
                clearable
                :style="{ width: '25%' }"
                readonly="readonly"
              >
                <template slot="prepend">经度</template> </el-input
              >&nbsp;&nbsp;&nbsp;&nbsp;
              <el-button
                type="primary"
                icon="el-icon-search"
                size="medium"
                @click="positionShow = true"
                v-show="edit"
              >
                地图选点</el-button
              >
            </el-form-item>
          </el-col>
          <el-col :span="24" v-show="form.storeLon">
            <el-form-item label="详细地址">
              <el-input
                v-model="form.addrDetail"
                placeholder="请输入详细地址"
                clearable
                :style="{ width: '100%' }"
                :disabled="!edit"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="营业时间" prop="businessTime">
              <el-time-picker
                v-model="businessTime"
                is-range
                format="HH:mm"
                value-format="HH:mm"
                :disabled="!edit"
                :style="{ width: '100%' }"
                start-placeholder="开始时间"
                end-placeholder="结束时间"
                range-separator="至"
                clearable
              >
              </el-time-picker>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="实景图" prop="storeImage">
              <ImageUpload
                @on-success="storeImageSuccess"
                v-model="form.storeImage"
                :limit="6"
                @on-remove="storeImageRemove"
              />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <MmvTitle title="运营信息"></MmvTitle>
          </el-col>
          <el-col :span="22" :offset="1" style="margin-bottom: 1%">
            <el-collapse
              accordion
              style="
                border: 1px solid rgb(242 242 242);
                text-align: left;
                border-radius: 4px;
                background-color: rgb(242 242 242);
              "
            >
              <el-row>
                <el-col :span="24">
                  <div style="color: rgb(51 51 51); margin: 10px 10px">
                    运营信息指南：
                  </div>
                </el-col>
                <el-col :span="2" style="font-size: 30px; text-align: center">
                  <i class="el-icon-info"></i>
                </el-col>
                <el-col :span="22" style="margin-bottom: 10px">
                  <div style="color: rgb(163 155 155)">
                    运营信息指门店送车上门/接客到店服务范围，设置后可根据范围内/范围外客户收取不同送车服务费
                  </div>
                  <div style="color: rgb(66 63 63)">
                    门店运营设置关系到客户查看门店服务收费明细，塑造良好的门店服务形象，请慎重填写规则。
                  </div>
                </el-col>
              </el-row>
            </el-collapse>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="服务范围/km"
              prop="serverScope"
              label-width="200px"
            >
              <el-input
                v-model="form.serverScope"
                placeholder="输入以门店为中心的半径"
                clearable
                :style="{ width: '100%' }"
                :disabled="!edit"
                maxlength="11"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="范围内服务费/元"
              prop="serviceChargeScope"
              label-width="150px"
            >
              <el-input
                v-model="form.serviceChargeScope"
                placeholder="输入金额/元"
                clearable
                :style="{ width: '100%' }"
                :disabled="!edit"
                maxlength="11"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="超范围收费标准km/元"
              prop="standardFees"
              label-width="200px"
            >
              <el-input
                v-model="form.standardFees"
                placeholder="请输入km/元"
                clearable
                :style="{ width: '100%' }"
                :disabled="!edit"
                maxlength="11"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item
              label="城市封顶费用/元"
              prop="cappingFees"
              label-width="150px"
            >
              <el-input
                v-model="form.cappingFees"
                placeholder="请输入金额/元"
                clearable
                :style="{ width: '100%' }"
                :disabled="!edit"
                maxlength="11"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div slot="footer">
        <el-button @click="cancel">取消</el-button>
        <el-button
          type="primary"
          @click="submitForm"
          v-show="edit"
          :loading="submitLoading"
          >确定</el-button
        >
      </div>
    </el-dialog>

    <!--地图选点 -->
    <el-dialog
      title="地图选点"
      :visible.sync="positionShow"
      width="800px"
      append-to-body
    >
      <position
        :showText="false"
        @input="getMapInfo"
        :areaName="form.areaName"
        v-if="positionShow"
      />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="positionShow = false">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listStore,
  getStore,
  delStore,
  addStore,
  updateStore,
  exportStore,
  editAvailable,
  getAllStore,
  getCityCode,
} from '@/api/store/store'
import { treeselect } from '@/api/system/dept'
import { regionData, CodeToText } from 'element-china-area-data' // 引入三级联动
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import MmvTitle from '@/components/MmvUI/MmvTitle.vue'
import position from '../../components/BaiduMap/baiduMapSeach.vue'

export default {
  name: 'Store',
  dicts: ['store_type', 'sys_available', 'store_class', 'service_mode'],
  components: {
    Treeselect,
    position,
    MmvTitle,
  },
  computed: {
    labelName: function () {
      return this.form.storeType == 1 ? '门店' : '网点'
    },
  },
  watch: {},
  data() {
    const validateAreaName = (rule, value, callback) => {
      if (!this.form.areaName) {
        callback(new Error('请选择省市区'))
      } else {
        callback()
      }
    }
    const validateImage = (rule, value, callback) => {
      if (!this.form.storeImage) {
        callback(new Error('请选择一个实景图'))
      } else {
        callback()
      }
    }
    return {
      submitLoading: false,
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 门店基本信息表格数据
      storeList: [],
      deptOptions: [],
      storeOptions: [],
      selectedOptions: [],
      // 选择地区数据
      options: [], //regionData省市区数据
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      edit: false,
      positionShow: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        storeName: null,
        storeType: null,
        provinceName: null,
        cityName: null,
        areaName: null,
        isAvailable: null,
      },

      columns: [
        {
          key: 0,
          label: `门店名称`,
          visible: true,
        },
        {
          key: 1,
          label: `门店分类`,
          visible: true,
        },
        {
          key: 2,
          label: `门店类型`,
          visible: true,
        },
        {
          key: 3,
          label: `服务模式`,
          visible: true,
        },
        {
          key: 4,
          label: `归属部门`,
          visible: true,
        },
        {
          key: 5,
          label: `所在省/市/区`,
          visible: true,
        },
        {
          key: 6,
          label: `营业时间`,
          visible: true,
        },
        {
          key: 7,
          label: `是否启用`,
          visible: true,
        },
      ],
      form: {
        storeType: 1,
        serviceMode: 1,
        storeClass: 1,
        storeName: undefined,
        companyId: undefined,
        contactName: undefined,
        contactPhone: undefined,
        addrDetail: undefined,
        storeLon: undefined,
        storeLat: undefined,
        field118: undefined,
        storeImage: null,
      },

      businessTime: ['08:00', '22:00'],
      rules: {
        storeType: [
          {
            required: true,
            message: '门店类型不能为空',
            trigger: 'change',
          },
        ],
        serviceMode: [
          {
            required: true,
            message: '服务模式不能为空',
            trigger: 'change',
          },
        ],
        storeClass: [
          {
            required: true,
            message: '门店分类不能为空',
            trigger: 'change',
          },
        ],
        storeName: [
          {
            required: true,
            message: '请输入名称',
            trigger: 'blur',
          },
        ],
        companyId: [
          {
            required: true,
            message: '请选择所属部门/门店',
            trigger: 'change',
          },
        ],
        contactName: [
          {
            required: true,
            message: '请输入联系人',
            trigger: 'blur',
          },
        ],
        contactPhone: [
          { required: true, message: '请输联系人电话' },
          {
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur',
          },
        ],
        areaName: [
          {
            required: true,
            message: '请选择省市区',
            trigger: 'blur',
            validator: validateAreaName,
          },
        ],
        addrDetail: [
          {
            required: true,
            message: '请输入详细地址',
            trigger: 'blur',
          },
        ],
        storeLon: [
          {
            required: true,
            message: '请输入经纬度',
            trigger: 'blur',
          },
        ],
        storeLat: [
          {
            required: true,
            message: '请输入经纬度',
            trigger: 'blur',
          },
        ],
        serverScope: [
          {
            validator(rule, value, callback) {
              if (!value || Number(value) == 0) {
                return callback()
              }
              if (!Number(value)) {
                callback(new Error('服务范围输入有误'))
              }
              if (Number(value) < 0) {
                callback(new Error('服务范围输入有误'))
              }
              return callback()
            },
          },
        ],
        serviceChargeScope: [
          {
            validator(rule, value, callback) {
              if (!value || Number(value) == 0) {
                return callback()
              }
              if (!Number(value)) {
                callback(new Error('范围内服务费输入有误'))
              }
              if (Number(value) < 0) {
                callback(new Error('范围内服务费输入有误'))
              }
              return callback()
            },
          },
        ],
        standardFees: [
          {
            validator(rule, value, callback) {
              if (!value || Number(value) == 0) {
                return callback()
              }
              if (!Number(value)) {
                callback(new Error('超范围收费标准输入有误'))
              }
              if (Number(value) < 0) {
                callback(new Error('超范围收费标准输入有误'))
              }
              return callback()
            },
          },
        ],
        cappingFees: [
          {
            validator(rule, value, callback) {
              if (!value || Number(value) == 0) {
                return callback()
              }
              if (!Number(value)) {
                callback(new Error('城市封顶费用输入有误'))
              }
              if (Number(value) < 0) {
                callback(new Error('城市封顶费用输入有误'))
              }
              return callback()
            },
          },
        ],
      },
    }
  },
  activated() {
    //调用列表函数
    this.getList()
},
  created() {
    this.getList()
  },
  methods: {
    /** 抛出数据 */
    async emitData() {
      const storeId = this.ids[0]
      const response = await getStore(storeId)
      return response?.data || {}
    },
    getCityCode() {
      getCityCode().then((res) => {
        let provinceIds = res.data.provinceIds
        let cityIds = res.data.cityIds
        let arr = []
        for (let var1 of regionData) {
          if (provinceIds.indexOf(var1.value) != -1) {
            let children = []
            for (let var2 of var1.children) {
              if (cityIds.indexOf(var2.value) != -1) {
                children.push(var2)
              }
            }
            let province = {
              label: var1.label,
              value: var1.value,
              children: children,
            }
            arr.push(province)
          }
        }
        this.options = arr
      })
    },
    changeType() {
      this.form.companyId = null
    },

    /** 查询部门下拉树结构 */
    getTreeselect() {
      treeselect().then((response) => {
        this.deptOptions = response.data
      })
    },
    /** 查询部门下拉树结构 */
    getAllStore() {
      getAllStore({ storeType: 1 }).then((response) => {
        this.storeOptions = response.data
      })
    },
    // 省市区三级
    handleChange(value) {
      var nodes = this.$refs['myCascader'].getCheckedNodes()
      if (nodes && nodes[0]) {
        var node = nodes[0]
        this.form.provinceId = node.parent.parent.value
        this.form.provinceName = node.parent.parent.label
        this.form.cityId = node.parent.value
        this.form.cityName = node.parent.label
        if ('市辖区' == node.parent.label) {
          this.form.cityName = node.parent.parent.label
        } else {
          this.form.cityName = node.parent.label
        }
        this.form.areaId = node.value
        this.form.areaName = node.label
      } else {
        this.form.provinceId = null
        this.form.provinceName = null
        this.form.cityId = null
        this.form.cityName = null
        this.form.areaId = null
        this.form.areaName = null
      }
    },
    /** 查询门店基本信息列表 */
    getList() {
      this.loading = true
      listStore(this.queryParams).then((response) => {
        this.storeList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.submitLoading = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        storeId: null,
        storeName: null,
        storeType: 1,
        serviceMode: 1,
        storeClass: 1,
        contactName: null,
        contactPhone: null,
        companyId: null,
        companyName: null,
        label: null,
        provinceId: null,
        provinceName: null,
        cityId: null,
        cityName: null,
        areaId: null,
        areaName: null,
        storeLon: null,
        storeLat: null,
        addrDetail: null,
        businessStartTime: null,
        businessEndTime: null,
        delFlag: null,
        isAvailable: 0,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        tenantId: null,
        deptId: null,
      }
      this.selectedOptions = []
      this.resetForm('elForm')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.storeId)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
       this.$router.push({name:"storeAdd"})
      // this.reset()
      // this.getTreeselect()
      // this.getAllStore()
      // this.getCityCode()
      // this.open = true
      // this.edit = true
      // this.title = '添加门店'
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      const storeId = row.storeId || this.ids
      this.$router.push({name:"storeEdit",query:{storeId:storeId}})
    },
    /** 详情按钮操作 */
    handleDetail(row) {
      const storeId = row.storeId || this.ids
      this.$router.push({name:"storeDetail",query:{storeId:storeId}})
    },
    // 删除门店图片
    storeImageRemove(file) {
      this.form.storeImage = null
    },
    // 上传成功门店回调
    storeImageSuccess(res) {
      this.form.storeImage = res.fileName
      this.$refs['form'].validateField('storeImage')
    },
    getMapInfo(res) {
      this.form.storeLon = JSON.parse(res).lng
      this.form.storeLat = JSON.parse(res).lat
      this.form.addrDetail = JSON.parse(res).address
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['elForm'].validate((valid) => {
        if (valid) {
          try {
            this.submitLoading = true
            if (this.businessTime && this.businessTime.length > 0) {
              this.form.businessStartTime = this.businessTime[0]
              this.form.businessEndTime = this.businessTime[1]
            }

            if (this.form.storeId != null) {
              updateStore(this.form)
                .then((response) => {
                  this.$modal.msgSuccess('修改成功')
                  this.open = false
                  this.getList()
                  this.submitLoading = false
                })
                .catch((error) => {
                  this.$modal.msgSuccess('修改失败')
                  this.submitLoading = false
                })
            } else {
              addStore(this.form)
                .then((response) => {
                  this.$modal.msgSuccess('新增成功')
                  this.open = false
                  this.getList()
                  this.submitLoading = false
                })
                .catch((error) => {
                  this.$modal.msgSuccess('新增失败')
                  this.submitLoading = false
                })
            }
          } catch (error) {
            this.submitLoading = false
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const storeIds = row.storeId || this.ids
      this.$modal
        .confirm('是否确认删除 [' + row.storeName + '] ？')
        .then(function () {
          return delStore(storeIds)
        })
        .then(() => {
          this.getList()
          this.$modal.msgSuccess('删除成功')
        })
        .catch(() => {})
    },
    /** 启用/停用 */
    handleAvailable(storeId, available) {
      editAvailable({
        storeId: storeId,
        isAvailable: available,
      }).then((response) => {
        this.$modal.msgSuccess('修改成功')
        this.open = false
        this.getList()
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams
      this.$modal
        .confirm('是否确认导出所有门店基本信息数据项？')
        .then(() => {
          this.exportLoading = true
          return exportStore(queryParams)
        })
        .then((response) => {
          this.$download.name(response.msg)
          this.exportLoading = false
        })
        .catch(() => {})
    },
  },
}
</script>
<style>
.el-upload__tip {
  line-height: 1.2;
}

.el-cascader {
  width: 100%;
}
</style>
